#include "zf_common_headfile.h"
#ifndef Element_H_
#define Element_H_

// typedef enum
// {
//     ELEMENMT_NONE,
//     CORNER_IN,
//     RIGHT_CROSS_IN,//If you enter the cross, you will not judge the other elements
//     LEFT_CROSS_IN,
//     LEFT_CIRCLE_IN,//Judgment of local range ring, stronger anti-interference
//     RIGHT_CIRCLE_IN,
//     CIRCLE_PREV_D_M,//There are up and down inflection points before entering the ring
//     CIRCLE_PREV_M,//There is only a mid-inflection point before entering the ring
//     CIRCLE_PREV_ARC, //IN ARC 圆弧路段
//     CIRCLE_WILL_IN,//Before entering the ring, you are about to enter the ring
//     CIRCLE_HAVE_IN,//In the ring
//     CIRCLE_OUT_D,//Out of the ring there is only an lower inflection point
//     CIRCLE_TURN_D,
//     CIRCLE_OUT_U,//Out of the ring there is only an upper inflection point

//     GARAGE_FIND, //find garage
// }Element_TendTypedef;



typedef struct
{
    unsigned char x;
    unsigned char y;
} Site_t;
typedef  struct
{
       Site_t  L_down_point;            //左边沿十字下方直角拐点数组（[0]为十字拐点行坐标值，[1]为十字拐点列坐标值）
       Site_t  L_up_point;              //左边沿十字上方直角拐点数组（[0]为十字拐点行坐标值，[1]为十字拐点列坐标值）

       Site_t  R_down_point;            //右边沿十字下方直角拐点数组（[0]为十字拐点行坐标值，[1]为十字拐点列坐标值）
       Site_t  R_up_point;              //右边沿十字上方直角拐点数组（[0]为十字拐点行坐标值，[1]为十字拐点列坐标值）

}Str_Inflection_point;    //拐点结构体
extern Str_Inflection_point  Inflection_point;




void find_right_line(unsigned char *img,uint8_t begin_y,uint8_t end_y);
void find_left_line (unsigned char *img,uint8_t begin_y,uint8_t end_y);
void fit_mid_line(unsigned char begin_y,unsigned char end_y);


int monotony_r(unsigned char big,unsigned char small);
int monotony_L(unsigned char big,unsigned char small);

int mislaid_r(unsigned char big,unsigned char small);//丢线检测
int mislaid_l(unsigned char big,unsigned char small);
int detect_icurvity(unsigned char mid,unsigned char step,unsigned char length,bool way);

void cross_process(void);
void Island_Judge(void);
void Island_Process(void);

unsigned char Garage_find (unsigned char col_begin,unsigned char col_end); //入库判断
void zebra_judge(void);
void zebra_process(void);
#endif
